Skip to content

fix: fix serialization of State and PipelineSnapshot - #12113

Merged
sjrl merged 3 commits into
mainfrom
fix-pipeline-snapshot-serialization
Jul 22, 2026
Merged

fix: fix serialization of State and PipelineSnapshot#12113
sjrl merged 3 commits into
mainfrom
fix-pipeline-snapshot-serialization

Conversation

@sjrl

@sjrl sjrl commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Related Issues

  • fixes #issue-number

Proposed Changes:

  • Fixed the schema-aware serialization helper used for pipeline snapshots and Agent State (_serialize_value_with_schema) so it no longer silently passes unsupported objects through as if they were serialized. Values such as datetime, bytes, complex and arbitrary objects without a to_dict method were previously stored unchanged and mislabeled as strings, which broke JSON storage and round-tripping of snapshots. Unsupported values now raise a SerializationError, and the callers that build snapshots (pipeline breakpoints and State.to_dict) catch it to omit only the offending field while keeping the rest of the payload resumable.

  • Added support for serializing and deserializing frozenset values in _serialize_value_with_schema. A frozenset now round-trips back to a frozenset instead of being dropped.

How did you test it?

Updated existing tests and added new ones.

Notes for the reviewer

cc @marc-mrt

Checklist

  • I have read the contributors guidelines and the code of conduct.
  • I have updated the related issue with new insights and changes.
  • I have added unit tests and updated the docstrings.
  • I've used one of the conventional commit types for my PR title: fix:, feat:, build:, chore:, ci:, docs:, style:, refactor:, perf:, test: and added ! in case the PR includes breaking changes.
  • I have documented my code.
  • I have added a release note file, following the contributors guidelines.
  • I have run pre-commit hooks and fixed any issue.

@sjrl
sjrl requested a review from a team as a code owner July 22, 2026 09:32
@sjrl
sjrl requested review from julian-risch and removed request for a team July 22, 2026 09:32
@vercel

vercel Bot commented Jul 22, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
haystack-docs Ignored Ignored Preview Jul 22, 2026 9:58am

Request Review

@sjrl sjrl self-assigned this Jul 22, 2026
@github-actions

github-actions Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  haystack/components/agents/state
  state.py
  haystack/core/pipeline
  breakpoint.py
  haystack/utils
  base_serialization.py
Project Total  

This report was generated by python-coverage-comment-action

@sjrl
sjrl merged commit 36793a9 into main Jul 22, 2026
25 checks passed
@sjrl
sjrl deleted the fix-pipeline-snapshot-serialization branch July 22, 2026 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants